import ajax from './index'

export function product_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/product/list",
    method: "get",
    params: condition
  });
}
// 小店自营商品列表
export function shopProductlist(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/product/shopProductlist",
    method: "get",
    params: condition
  });
}

export function product_save(param) {
  return ajax({
    url: "/backend/product/save",
    method: "post",
    data: param
  });
}
export function product_detail(id) {
  return ajax({
    url: "/backend/product/detail" + "/" + id,
    method: "get"
  });
}
export function product_delete(id) {
  return ajax({
    url: "/backend/product/delete" + "/" + id,
    method: "post"
  });
}
export function product_recovery(id) {
  return ajax({
    url: "/backend/product/recovery" + "/" + id,
    method: "post"
  });
}

export function product_update_order(param) {
  return ajax({
    url: "/backend/product/update_order",
    method: "post",
    data: param
  });
}

export function product_up(param) {
  return ajax({
    url: "/backend/product/up",
    method: "post",
    data: param
  });
}

export function product_sync() {
  return ajax({
    url: "/backend/product/ycSync",
    method: "get",
  });
}

export function product_down(param) {
  return ajax({
    url: "/backend/product/down",
    method: "post",
    data: param
  });
}

export function product_category(pid) {
  return ajax({
    url: "/backend/product_category/listAll" + "/" + pid,
    method: "get"
  });
}

export function product_cat_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/product_category/list",
    method: "get",
    params: condition
  });
}

export function product_cat_add(param) {
  return ajax({
    url: "/backend/product_category/create",
    method: "post",
    data: param
  });
}

export function product_cat_edit(id, param) {
  return ajax({
    url: "/backend/product_category/update/" + id,
    method: "post",
    data: param
  });
}

export function product_cat_del(id) {
  return ajax({
    url: "/backend/product_category/delete?ids=" + id,
    method: "post"
  });
}

export function product_cat_detail(id) {
  return ajax({
    url: "/backend/product_category/detail/" + id,
    method: "get"
  });
}

export function product_cat_tree(parentId) {
  return ajax({
    url: "/backend/product_category/tree/" + parentId,
    method: "get"
  });
}

export function product_page_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/product/pageList",
    method: "get",
    params: condition
  });
}

export function product_page_save(param) {
  return ajax({
    url: "/backend/product/pageSave",
    method: "post",
    data: param
  });
}
export function product_page_detail(id) {
  return ajax({
    url: "/backend/product/pageDetail" + "/" + id,
    method: "get"
  });
}
export function product_page_delete(id) {
  return ajax({
    url: "/backend/product/pageDelete" + "/" + id,
    method: "post"
  });
}
export function product_page_switch(id) {
  return ajax({
    url: "/backend/product/pageSwitch" + "/" + id,
    method: "post"
  });
}
export function product_page_in_tab(id) {
  return ajax({
    url: "/backend/product/pageInTab" + "/" + id,
    method: "post"
  });
}
export function product_page_in_mine(id) {
  return ajax({
    url: "/backend/product/pageInMine" + "/" + id,
    method: "post"
  });
}

export function product_page_relate_list(pageId, condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/product/pageRelateList/" + pageId,
    method: "get",
    params: condition
  });
}
export function product_add_to_page(param) {
  return ajax({
    url: "/backend/product/addToPage",
    method: "post",
    data: param
  });
}
export function product_remove_from_page(param) {
  return ajax({
    url: "/backend/product/removeFromPage",
    method: "post",
    data: param
  });
}

export function product_update_page_order(param) {
  return ajax({
    url: "/backend/product/updatePageOrder",
    method: "post",
    data: param
  });
}
export function product_freight_template_list() {
  return ajax({
    url: "/backend/product/freightTemplateList",
    method: "get",
  });
}
export function product_freight_template_save(param) {
  return ajax({
    url: "/backend/product/freightTemplateSave",
    method: "post",
    data: param
  });
}
export function product_freight_template_detail(id) {
  return ajax({
    url: "/backend/product/freightTemplateDetail" + "/" + id,
    method: "get"
  });
}
export function product_freight_template_delete(id) {
  return ajax({
    url: "/backend/product/freightTemplateDelete" + "/" + id,
    method: "post"
  });
}
export function region_group_list() {
  return ajax({
    url: "/backend/product/regionGroup",
    method: "get",
  });
}


export function package_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/package/list",
    method: "get",
    params: condition
  });
}

export function package_save(param) {
  return ajax({
    url: "/backend/package/save",
    method: "post",
    data: param
  });
}
export function package_detail(id) {
  return ajax({
    url: "/backend/package/detail" + "/" + id,
    method: "get"
  });
}
export function package_delete(id) {
  return ajax({
    url: "/backend/package/delete" + "/" + id,
    method: "post"
  });
}

export function package_update_order(param) {
  return ajax({
    url: "/backend/package/update_order",
    method: "post",
    data: param
  });
}

export function package_up(param) {
  return ajax({
    url: "/backend/package/up",
    method: "post",
    data: param
  });
}

export function package_down(param) {
  return ajax({
    url: "/backend/package/down",
    method: "post",
    data: param
  });
}

export function discount_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/product/discountList",
    method: "get",
    params: condition
  });
}

export function discount_save(param) {
  return ajax({
    url: "/backend/product/discountSave",
    method: "post",
    data: param
  });
}
export function discount_detail(id) {
  return ajax({
    url: "/backend/product/discountDetail" + "/" + id,
    method: "get"
  });
}
export function discount_delete(id) {
  return ajax({
    url: "/backend/product/discountDelete" + "/" + id,
    method: "post"
  });
}



export function task_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/task/list",
    method: "get",
    params: condition
  });
}

export function task_save(param) {
  return ajax({
    url: "/backend/task/save",
    method: "post",
    data: param
  });
}
export function task_detail(id) {
  return ajax({
    url: "/backend/task/detail" + "/" + id,
    method: "get"
  });
}
export function task_delete(id) {
  return ajax({
    url: "/backend/task/delete" + "/" + id,
    method: "post"
  });
}
export function project_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/project/list",
    method: "get",
    params: condition
  });
}

export function project_save(param) {
  return ajax({
    url: "/backend/project/save",
    method: "post",
    data: param
  });
}
export function project_detail(id) {
  return ajax({
    url: "/backend/project/detail" + "/" + id,
    method: "get"
  });
}
export function project_delete(id) {
  return ajax({
    url: "/backend/project/delete" + "/" + id,
    method: "post"
  });
}

export function task_activity_list(condition) {
  if (!condition) {
    condition = {
      page: 1,
      num: 100
    }
  }
  return ajax({
    url: "/backend/task/activityList",
    method: "get",
    params: condition
  });
}

export function task_activity_save(param) {
  return ajax({
    url: "/backend/task/activitySave",
    method: "post",
    data: param
  });
}
export function task_activity_detail(id) {
  return ajax({
    url: "/backend/task/activityDetail" + "/" + id,
    method: "get"
  });
}
export function task_activity_delete(id) {
  return ajax({
    url: "/backend/task/activityDelete" + "/" + id,
    method: "post"
  });
}
export function productExport(query) {
  return ajax({
    url: '/backend/product/export',
    method: 'get',
    params: query
  });
}

export function productImport(data) {
  return ajax({
    url: '/backend/product/import',
    method: 'post',
    data: data
  })
}

// 自提点列表
export function pickPoint(query) {
  return ajax({
    url: '/backend/pickPoint/pageList',
    method: 'get',
    params: query
  });
}
export function pickPointUpdate(data) {
  return ajax({
    url: '/backend/pickPoint/update',
    method: 'post',
    data: data
  })
}
export function pickPointAdd(data) {
  return ajax({
    url: '/backend/pickPoint/add',
    method: 'post',
    data: data
  })
}
export function pickPointDelete(ids) {
  return ajax({
    url: `/backend/pickPoint/delete/${ids}`,
    method: 'get'
  })
}
